package com.gimi.cloud.bbp.manage.consumer.controller;

import com.gimi.cloud.bbp.common.enums.ResponseCodeEnum;
import com.gimi.cloud.bbp.common.enums.ServiceNameEnum;
import com.gimi.cloud.bbp.common.exception.MsgException;
import com.gimi.cloud.bbp.common.utils.CommonUtil;
import com.gimi.cloud.bbp.common.utils.JsonUtil;
import com.gimi.cloud.bbp.common.utils.reqhead.Response;
import com.gimi.cloud.bbp.dto.base.BaseDTO;
import com.gimi.cloud.bbp.dto.log.LogMasterLoginDTO;
import com.gimi.cloud.bbp.dto.log.LogOperationDTO;
import com.gimi.cloud.bbp.dto.log.LogScheduleJobDTO;
import com.gimi.cloud.bbp.dto.mall.*;
import com.gimi.cloud.bbp.dto.params.LoginParams;
import com.gimi.cloud.bbp.dto.sys.SysAuthorityDTO;
import com.gimi.cloud.bbp.dto.sys.SysMasterDTO;
import com.gimi.cloud.bbp.dto.sys.SysMenuDTO;
import com.gimi.cloud.bbp.dto.sys.SysRoleDTO;
import com.gimi.cloud.bbp.dto.task.ScheduleJobDTO;
import com.gimi.cloud.bbp.manage.consumer.service.IndexService;
import com.gimi.cloud.bbp.manage.consumer.service.LoginService;
import com.gimi.cloud.bbp.manage.consumer.service.app.AdService;
import com.gimi.cloud.bbp.manage.consumer.service.app.ColumnService;
import com.gimi.cloud.bbp.manage.consumer.service.app.MajorAdService;
import com.gimi.cloud.bbp.manage.consumer.service.log.LogJPushService;
import com.gimi.cloud.bbp.manage.consumer.service.log.LogMasterLoginService;
import com.gimi.cloud.bbp.manage.consumer.service.mall.*;
import com.gimi.cloud.bbp.manage.consumer.service.order.*;
import com.gimi.cloud.bbp.manage.consumer.service.page.PageColumnService;
import com.gimi.cloud.bbp.manage.consumer.service.page.PageConfigService;
import com.gimi.cloud.bbp.manage.consumer.service.page.PageModelService;
import com.gimi.cloud.bbp.manage.consumer.service.page.PageTemplateService;
import com.gimi.cloud.bbp.manage.consumer.service.prod.BrandService;
import com.gimi.cloud.bbp.manage.consumer.service.prod.EcProdCategoryService;
import com.gimi.cloud.bbp.manage.consumer.service.prod.LogisticsCompanyService;
import com.gimi.cloud.bbp.manage.consumer.service.prod.ProdCatModelService;
import com.gimi.cloud.bbp.manage.consumer.service.sys.*;
import com.gimi.cloud.bbp.manage.consumer.service.task.ScheduleJobService;
import com.gimi.cloud.bbp.manage.consumer.service.userInfo.UserInfoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;


@RestController
public class ManageMicroServiceConsumerController {

	private static Logger logger = LoggerFactory.getLogger(ManageMicroServiceConsumerController.class);
	private final EcProdCategoryService categoryService;
	private final BrandService brandService;
	private final ProdCatModelService prodCatModelService;
	private final ConfigService configService;
	private final AdService adService;
	private final ColumnService columnService;
	private final UserInfoService userInfoService;
	private final MajorAdService majorAdService;
	private final OrderService orderService;
	private final OrderGoodsService orderGoodsService;
	private final OrderExpressService orderExpressService;
	private final OrderInvoiceService orderInvoiceService;
	private final OrderCostService orderCostService;
	private final OrderLogisticsService orderLogisticsService;
	private final PageConfigService pageConfigService;
	private final PageTemplateService pageTemplateService;
	private final PageModelService pageModelService;
	private final PageColumnService pageColumnService;
	private final MallMessageService mallMessageService;
	private final SysMenuService sysMenuService;
	private final PublicService publicService;
	private final SysMasterService sysMasterService;
	private final SysRoleService sysRoleService;
	private final LoginService loginService;
	private final IndexService indexService;
	private final LogMasterLoginService logMasterLoginService;
	private final SysAuthorityService sysAuthorityService;
	private final MallBannerGroupService mallBannerGroupService;
	private final MallSpecialGroupService mallSpecialGroupService;
	private final MallRecommentGroupService mallRecommentGroupService;
	private final LogJPushService logJPushService;
	private final MallSuggestService mallSuggestService;
	private final LogisticsCompanyService logisticsCompanyService;
	private final MallAppCloumnService mallAppCloumnService;
	private final ScheduleJobService scheduleJobService;

	@Autowired
	public ManageMicroServiceConsumerController(EcProdCategoryService categoryService, BrandService brandService, ProdCatModelService prodCatModelService, ConfigService configService, AdService adService, ColumnService columnService, UserInfoService userInfoService, MajorAdService majorAdService, OrderService orderService, OrderGoodsService orderGoodsService, OrderExpressService orderExpressService, OrderInvoiceService orderInvoiceService, OrderCostService orderCostService, OrderLogisticsService orderLogisticsService, PageConfigService pageConfigService, PageTemplateService pageTemplateService, PageModelService pageModelService, PageColumnService pageColumnService, MallMessageService mallMessageService, SysMenuService sysMenuService, PublicService publicService, SysMasterService sysMasterService, SysRoleService sysRoleService, LoginService loginService, IndexService indexService, LogMasterLoginService logMasterLoginService, SysAuthorityService sysAuthorityService, MallBannerGroupService mallBannerGroupService, MallSpecialGroupService mallSpecialGroupService, MallRecommentGroupService mallRecommentGroupService, LogJPushService logJPushService, MallSuggestService mallSuggestService, LogisticsCompanyService logisticsCompanyService, MallAppCloumnService mallAppCloumnService, ScheduleJobService scheduleJobService) {
		this.categoryService = categoryService;
		this.brandService = brandService;
		this.prodCatModelService = prodCatModelService;
		this.configService = configService;
		this.adService = adService;
		this.columnService = columnService;
		this.userInfoService = userInfoService;
		this.majorAdService = majorAdService;
		this.orderService = orderService;
		this.orderGoodsService = orderGoodsService;
		this.orderExpressService = orderExpressService;
		this.orderInvoiceService = orderInvoiceService;
		this.orderCostService = orderCostService;
		this.orderLogisticsService = orderLogisticsService;
		this.pageConfigService = pageConfigService;
		this.pageTemplateService = pageTemplateService;
		this.pageModelService = pageModelService;
		this.pageColumnService = pageColumnService;
		this.mallMessageService = mallMessageService;
		this.sysMenuService = sysMenuService;
		this.publicService = publicService;
		this.sysMasterService = sysMasterService;
		this.sysRoleService = sysRoleService;
		this.loginService = loginService;
		this.indexService = indexService;
		this.logMasterLoginService = logMasterLoginService;
		this.sysAuthorityService = sysAuthorityService;
		this.mallBannerGroupService = mallBannerGroupService;
		this.mallSpecialGroupService = mallSpecialGroupService;
		this.mallRecommentGroupService = mallRecommentGroupService;
		this.logJPushService = logJPushService;
		this.mallSuggestService = mallSuggestService;
		this.logisticsCompanyService = logisticsCompanyService;
		this.mallAppCloumnService = mallAppCloumnService;
		this.scheduleJobService = scheduleJobService;
	}

	/**
	 * 作为后台服务的统一入口.
	 * @param requestData 请求参数
	 * @param request httpRequest
	 * @param response response
	 */
	@RequestMapping(value = "service")
	@ResponseBody
	public Response manageService(@RequestBody(required = false) String requestData, @RequestParam(value = "file",required = false) MultipartFile file
			, HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		logger.info("===>进入后台manage微服务主程序入口.");
		logger.info("token===>" + request.getHeader("authorization"));
		logger.info("serviceName===>" + request.getHeader("serviceName"));
        logger.info("入参requestData："+requestData);
		Response resp = new Response();
		//记录日志
		LogOperationDTO logOperation = new LogOperationDTO();
		//请求时间
		logOperation.setOpTime(new Date());
		/**
		 * 网关中的添加人更新人属性放入body
		 */
		Map<String,String> headerMaps = new HashMap<>();
		//设置请求body的key为authToken，对应头的key为authorization
		headerMaps.put("authToken","authorization");
		String[] headersKeys = new String[]{"ip","authToken","uid","uname","serviceName"};
		requestData = CommonUtil.initHeaderInfoToBody(request,requestData,headersKeys,headerMaps,false);
		ServiceNameEnum serviceNameEnum = ServiceNameEnum.getStatus(request.getHeader("serviceName"));
		try{
			switch (serviceNameEnum) {
				/** 保存页面*/
				case PAGE_CONFIG_SAVE:
					resp = pageConfigService.saveInfo(requestData,request,response);
					break;
				/** 获取页面列表*/
				case PAGE_CONFIG_GETLIST:
					resp = pageConfigService.getList(requestData,request,response);
					break;
				/** 注删除页面*/
				case PAGE_CONFIG_DEL:
					resp = pageConfigService.delInfo(requestData,request,response);
					break;
				/** 注删除页面*/
				case PAGE_CONFIG_GET_INFO_BY_ID:
					resp = pageConfigService.getInfoById(requestData,request,response);
					break;
				/** 保存页面模板*/
				case PAGE_TEMPLATE_SAVE:
					resp = pageTemplateService.saveInfo(requestData,request,response);
					break;
				/** 获取页面模*/
				case PAGE_TEMPLATE_GETLIST:
					resp = pageTemplateService.getList(requestData,request,response);
					break;
				/** 删除页面模板*/
				case PAGE_TEMPLATE_DEL:
					resp = pageTemplateService.delInfo(requestData,request,response);
					break;
				/** 删除页面模板*/
				case PAGE_TEMPLATE_GET_INFO_BY_ID:
					resp = pageTemplateService.getInfoById(requestData,request,response);
					break;
				/** 保存页面模板*/
				case PAGE_MODEL_SAVE:
					resp = pageModelService.saveInfo(requestData,request,response);
					break;
				/** 获取页面模*/
				case PAGE_MODEL_GETLIST:
					resp = pageModelService.getList(requestData,request,response);
					break;
				/** 删除页面模板*/
				case PAGE_MODEL_DEL:
					resp = pageModelService.delInfo(requestData,request,response);
					break;
				/** 删除页面模板*/
				case PAGE_MODEL_GET_INFO_BY_ID:
					resp = pageModelService.getInfoById(requestData,request,response);
					break;
				/** 保存栏目*/
				case PAGE_PAGECOLUMN_SAVE_INFO:
					resp = pageColumnService.savePageColumn(requestData,request,response);
					break;
				/** 获取页面模*/
				case PAGE_PAGECOLUMN_GETLIST:
					resp = pageColumnService.delPageColumnAllById(requestData,request,response);
					break;
				/** 删除页面模板*/
				case PAGE_PAGECOLUMN_GETINFO:
					resp = pageColumnService.getPageColumnById(requestData,request,response);
					break;
				/** 删除页面模板*/
				case PAGE_PAGECOLUMN_ADD_BY_TEMPLATEID:
					resp = pageColumnService.addPageColumnByTemplateId(requestData,request,response);
					break;
				/** 推送消息到用户消息中心*/
				case MESSAGE_SEND_MESSAGE:
					resp = mallMessageService.sendMessage(requestData, request, response);
					break;
				/** 获取极光推送日志*/
				case LOG_JPUSH_GET_LIST:
					resp = logJPushService.getLogJPushList(requestData, request, response);
					break;
				/** 获取商品三级品类列表*/
				case CATEGORY_LIST:
					resp = categoryService.getCategoryList(requestData,request,response);
					break;
				/** 根据参数查询出所有的对应商品品类列表*/
				case SEARCH_CATEGORY_LIST_BY_GRADE:
					resp = categoryService.searchCategoryListByGrade(requestData,request,response);
					break;
				/** 获取商品品类列表(分页)*/
				case CATEGORY_PAGE_LIST:
					resp = categoryService.getCategoryPageList(requestData,request,response);
					break;
				/** 商品品类图标文件上传*/
				case CATEGORY_ICON_UPLOAD:
					resp = categoryService.iconUpload(request,response);
					break;
				/** 新增商品品类*/
				case CATEGORY_ADD:
					resp = categoryService.addCategory(requestData,request,response);
					break;
				/** 修改商品品类*/
				case CATEGORY_UPDATE:
					resp = categoryService.updateCategory(requestData,request,response);
					break;
				/** 转跳到编辑商品品类界面*/
				case GOTO_EDIT_PRODCATEGORY:
					resp = categoryService.gotoEditProdCategory(requestData,request,response);
					break;
				/** 逻辑删除/启用商品品类*/
				case CATEGORY_DELETE:
					resp = categoryService.deleteCategory(requestData,request,response);
					break;
				/** 商品品牌文件上传*/
				case BRAND_FILE_UPLOAD:
					resp = brandService.fileUpload(response,request);
					break;
				/** 获取商品品牌列表*/
				case BRAND_LIST:
					resp = brandService.getBrandList(requestData,request,response);
					break;
				/** 获取商品品牌列表(分页)*/
				case BRAND_PAGE_LIST:
					resp = brandService.getBrandPageList(requestData,request,response);
					break;
				/** 新增商品品牌*/
				case BRAND_ADD:
					resp = brandService.addBrand(requestData,request,response);
					break;
				/** 修改商品品牌*/
				case BRAND_UPDATE:
					resp = brandService.updateBrand(requestData,request,response);
					break;
				/** 转跳到编辑商品品类界面*/
				case GOTO_EDIT_PRODBRAND:
					resp = brandService.gotoEditProdBrand(requestData,request,response);
					break;
				/** 删除商品品牌*/
				case BRAND_DELETE:
					resp = brandService.deleteBrand(requestData,request,response);
					break;
				/** 获取商品品类模板列表*/
				case GET_PRODCATMODEL_LIST:
					resp = prodCatModelService.getProdCatModelList(requestData,request,response);
					break;
				/** 添加商品品类模板*/
				case ADD_PRODCATMODEL:
					resp = prodCatModelService.addProdCatModel(requestData,request,response);
					break;
				/** 编辑商品品类模板*/
				case EDIT_PRODCATMODEL:
					resp = prodCatModelService.editProdCatModel(requestData,request,response);
					break;
				/** 转跳到编辑商品品类模板界面*/
				case GOTO_EDIT_PRODCATMODEL:
					resp = prodCatModelService.gotoEditProdCatModel(requestData,request,response);
					break;
				/** 删除商品品类模板，逻辑删除/启用，非真实删除*/
				case DELETE_PRODCATMODEL:
					resp = prodCatModelService.deleteProdCatModel(requestData,request,response);
					break;
				/** 删除商品品类模板*/
				case REAL_DELETE_PRODCATMODEL:
					resp = prodCatModelService.realDeleteProdCatModel(requestData,request,response);
					break;
				/** 获得模板对应的所有属性值*/
				case GET_PRODCATMODEL_VALUE_LIST:
					resp = prodCatModelService.getProdCatModelValueList(requestData,request,response);
					break;
				/** 添加指定模板的属性值*/
				case ADD_PRODCATMODEL_VALUE:
					resp = prodCatModelService.addProdCatModelValue(requestData,request,response);
					break;
				/** 跳转到指定模板的属性值修改界面*/
				case GOTO_EDIT_PRODCATMODEL_VALUE:
					resp = prodCatModelService.gotoEditProdCatModelValue(requestData,request,response);
					break;
				/** 修改指定模板的属性值*/
				case EDIT_PRODCATMODEL_VALUE:
					resp = prodCatModelService.editProdCatModelValue(requestData,request,response);
					break;
				/** 删除指定模板的属性的其中一个值*/
				case REAL_DELETE_PRODCATMODEL_VALUE:
					resp = prodCatModelService.realDeleteProdCatModelValue(requestData,request,response);
					break;
				/** 获取系统配置列表*/
				case CONFIG_LIST:
					resp = configService.getConfigList(requestData, request, response);
					break;
				/** 获取系统配置列表*/
				case CONFIG_PAGELIST:
					resp = configService.getConfigPageList(requestData, request, response);
					break;
				/** 添加系统配置*/
				case CONFIG_ADD:
					resp = configService.addConfig(requestData, request, response);
					break;
				/** 更新系统配置*/
				case CONFIG_UPDATE:
					resp = configService.updateConfig(requestData, request, response);
					break;
				/** 获得单一系统配置实体*/
				case CONFIG_SINGLE:
					resp = configService.getConfigSingle(requestData, request, response);
					break;
				/** 删除系统配置*/
				case CONFIG_DELETE:
					resp = configService.deleteConfig(requestData, request, response);
					break;
				/** 添加广告*/
				case ADD_AD:
					resp = adService.addAd(requestData, request, response);
					break;
				/** 获得广告列表展示（分页）*/
				case GET_ADLIST:
					resp = adService.getAdList(requestData, request, response);
					break;
				/** 删除广告*/
				case DELETE_AD:
					resp = adService.deleteAd(requestData, request, response);
					break;
				/** 编辑广告*/
				case EDIT_AD:
					resp = adService.editAd(requestData, request, response);
					break;
				/** 转跳到编辑广告页面（查询指定广告）*/
				case GOTO_EDIT_AD:
					resp = adService.gotoEditAd(requestData, request, response);
					break;
				/** 转跳到编辑广告页面（查询出所有的栏目对象）*/
				case GOTO_ADD_AD:
					resp = adService.gotoAddAd(requestData, request, response);
					break;
				/** 发布广告*/
				case PUBLISH_AD:
					resp = adService.publishAd(requestData, request, response);
					break;
				/** 撤下广告*/
				case UNDER_AD:
					resp = adService.underAd(requestData, request, response);
					break;
				/** 上传广告文件*/
				case UPLOAD_AD_FILE:
					resp = adService.uploadAdFile(response,request);
					break;
				/** 添加首页广告*/
				case ADD_MAJORAD:
					resp = majorAdService.AddMajorAd(requestData, request, response);
					break;
				/** 删除首页广告*/
				case DELETE_MAJORAD:
					resp = majorAdService.deleteMajorAd(requestData, request, response);
					break;
				/** 编辑首页广告*/
				case EDIT_MAJORAD:
					resp = majorAdService.editMajorAd(requestData, request, response);
					break;
				/** 获得首页广告列表展示（分页）*/
				case GET_MAJORAD_LIST:
					resp = majorAdService.getMajorAdList(requestData, request, response);
					break;
				/** 转跳到编辑首页广告页面（查询指定首页广告）*/
				case GOTO_EDIT_MAJORAD:
					resp = majorAdService.gotoEditMajorAd(requestData, request, response);
					break;
				/** 发布首页广告*/
				case PUBLISH_MAJORAD:
					resp = majorAdService.publishMajorAd(requestData, request, response);
					break;
				/** 撤下首页广告*/
				case UNDER_MAJORAD:
					resp = majorAdService.underMajorAd(requestData, request, response);
					break;
				/** 上传首页广告图片*/
				case UPLOAD_MAJORAD_FILE:
					resp = majorAdService.uploadMajorAdFile(response,request);
					break;
				/** 添加栏目*/
				case ADD_COLUMN:
					resp = columnService.addColumn(requestData, request, response);
					break;
				/** 获得栏目列表展示（分页）*/
				case GET_COLUMNLIST:
					resp = columnService.getColumnList(requestData, request, response);
					break;
				/** 启用/禁用栏目*/
				case DELETE_COLUMN:
					resp = columnService.deleteColumn(requestData, request, response);
					break;
				/** 编辑栏目*/
				case EDIT_COLUMN:
					resp = columnService.editColumn(requestData, request, response);
					break;
				/** 转跳到编辑栏目页面（查询指定栏目*/
				case GOTO_EDIT_COLUMN:
					resp = columnService.gotoEditColumn(requestData, request, response);
					break;
				/** 查询User详情列表*/
				case USERINFO_LIST:
					resp = userInfoService.userInfoList(requestData, request, response);
					break;
				/** 查询User详情列表(分页)*/
				case USERINFO_PAGELIST:
					resp = userInfoService.userInfoPageList(requestData, request, response);
					break;
				/** 查询单个use实体*/
				case USERINFO_SINGLE:
					resp = userInfoService.getUserInfoSingle(requestData, request, response);
					break;
				/** 更新user信息*/
				case USERINFO_UPDATE:
					resp = userInfoService.userInfoUpdate(requestData, request, response);
					break;
				/**********************订单管理  start*********************************/
				/** 订单列表分页*/
				case ORDER_PAGELIST:
					resp = orderService.OrderPageList(requestData, request, response);
					break;
				/** 更新订单状态信息*/
				case ORDER_STATUS:
					resp = orderService.orderStatus(requestData, request, response);
					break;
				/** 获得单个订单实体*/
				case ORDER_SINGLE_BASE:
					resp = orderService.getSingleOrderBase(requestData, request, response);
					break;
				/** 更新订单基本信息*/
				case ORDER_UPDATE_BASE:
					resp = orderService.updateOrderBase(requestData, request, response);
					break;
				/** 删除单个订单信息*/
				case ORDER_DELETE:
					resp = orderService.deleteOrder(requestData, request, response);
					break;
				/** 订单详细信息*/
				case ORDER_DETAIL:
					resp = orderService.showOrderDetail(requestData, request, response);
					break;
				/** 删除单个订单配送信息*/
				case ORDER_EXPRESS_DELETE:
					resp = orderExpressService.deleteOrderExpress(requestData, request, response);
					break;
				/** 获得单个订单配送信息*/
				case ORDER_EXPRESS_SINGLE:
					resp = orderExpressService.getSingleOrderExpress(requestData, request, response);
					break;
				/** 修改单个订单配送信息*/
				case ORDER_EXPRESS_UPDATE:
					resp = orderExpressService.updateOrderExpress(requestData, request, response);
					break;
				/** 删除单个订单费用信息*/
				case ORDER_COST_DELETE:
					resp = orderCostService.deleteOrderCost(requestData, request, response);
					break;
				/** 获得单个订单费用信息*/
				case ORDER_COST_SINGLE:
					resp = orderCostService.getSingleOrderCost(requestData, request, response);
					break;
				/** 修改单个订单费用信息*/
				case ORDER_COST_UPDATE:
					resp = orderCostService.updateOrderCost(requestData, request, response);
					break;
				/** 删除单个订单发票信息*/
				case ORDER_INVOICE_DELETE:
					resp = orderInvoiceService.deleteOrderInvoice(requestData, request, response);
					break;
				/** 获得单个订单发票信息*/
				case ORDER_INVOICE_SINGLE:
					resp = orderInvoiceService.getSingleOrderInvoice(requestData, request, response);
					break;
				/** 修改单个订单发票信息*/
				case ORDER_INVOICE_UPDATE:
					resp = orderInvoiceService.updateOrderInvoice(requestData, request, response);
					break;
				/** 删除单个订单商品信息*/
				case ORDER_GOODS_DELETE:
					resp = orderGoodsService.deleteOrderGoods(requestData, request, response);
					break;
				/** 获得单个订单商品信息*/
				case ORDER_GOODS_SINGLE:
					resp = orderGoodsService.getSingleOrderGoods(requestData, request, response);
					break;
				/** 修改单个订单商品信息*/
				case ORDER_GOODS_UPDATE:
					resp = orderGoodsService.updateOrderGoods(requestData, request, response);
					break;
				/** 删除单个订单物流信息*/
				case ORDER_LOGISTICS_DELETE:
					resp = orderLogisticsService.deleteOrderLogistics(requestData, request, response);
					break;
				/** 获得单个订单物流信息*/
				case ORDER_LOGISTICS_SINGLE:
					resp = orderLogisticsService.getSingleOrderLogistics(requestData, request, response);
					break;
				/** 修改单个订单物流信息*/
				case ORDER_LOGISTICS_UPDATE:
					resp = orderLogisticsService.updateOrderLogistics(requestData, request, response);
					break;
				/**********************订单管理  end*******************************************************/

				/****************************系统相关接口  Start**************************************/
				/****************登录登出相关接口 Start********************/
				/** 登录*/
				case SYS_MASTER_LOGIN:
					resp = loginService.login(request,response,JsonUtil.jsonToBean(requestData, LoginParams.class));
					break;
				/** 注销登录*/
				case SYS_MASTER_LOGOUT:
					resp = loginService.logout(request,response,JsonUtil.jsonToBean(requestData,SysMasterDTO.class));
					break;
				/** 获取用户权限*/
				case SYS_MASTER_PERMISSION:
					resp = indexService.getPermission(request,response,JsonUtil.jsonToBean(requestData,SysMasterDTO.class));
					break;
				/****************登录登出相关接口 End********************/
				/****************菜单相关接口 Start********************/
				//获取菜单树状结构
				case SYS_MENU_TREE:
					resp = sysMenuService.getMenuTree(request,response,JsonUtil.jsonToBean(requestData, SysMenuDTO.class));
					break;
				/** 获取菜单信息*/
				case SYS_MENU_INFO:
					resp = sysMenuService.getMenuInfo(request,response,JsonUtil.jsonToBean(requestData, SysMenuDTO.class));
					break;
				/** 新增菜单信息*/
				case SYS_MENU_ADD:
					resp = sysMenuService.addMenu(request,response,JsonUtil.jsonToBean(requestData, SysMenuDTO.class));
					break;
				/** 修改菜单信息*/
				case SYS_MENU_EDIT:
					resp = sysMenuService.editMenu(request,response,JsonUtil.jsonToBean(requestData, SysMenuDTO.class));
					break;
				/** 删除菜单信息*/
				case SYS_MENU_DELETE:
					resp = sysMenuService.deleteMenu(request,response,JsonUtil.jsonToBean(requestData, SysMenuDTO.class));
					break;
				/****************菜单相关接口 ********************/
				/****************管理员相关接口 Start********************/
				/** 获取管理员列表*/
				case SYS_MASTER_LIST:
					resp = sysMasterService.getMasterList(request,response,JsonUtil.jsonToBean(requestData, SysMasterDTO.class));
					break;
				/** 获取管理员信息*/
				case SYS_MASTER_INFO:
					resp = sysMasterService.getMasterInfo(request,response,JsonUtil.jsonToBean(requestData, SysMasterDTO.class));
					break;
				/** 新增管理员信息*/
				case SYS_MASTER_ADD:
					resp = sysMasterService.addMaster(request,response,JsonUtil.jsonToBean(requestData, SysMasterDTO.class));
					break;
				/** 修改管理员信息*/
				case SYS_MASTER_EDIT:
					resp = sysMasterService.editMaster(request,response,JsonUtil.jsonToBean(requestData, SysMasterDTO.class));
					break;
				/** 删除管理员信息*/
				case SYS_MASTER_DELETE:
					resp = sysMasterService.deleteMaster(request,response,JsonUtil.jsonToBean(requestData, SysMasterDTO.class));
					break;
				/****************管理员相关接口 ********************/
				/****************角色相关接口 Start********************/
				/** 获取角色树状结构*/
				case SYS_ROLE_LIST:
					resp = sysRoleService.getRoleList(request,response,JsonUtil.jsonToBean(requestData, SysRoleDTO.class));
					break;
				/** 获取角色信息*/
				case SYS_ROLE_INFO:
					resp = sysRoleService.getRoleInfo(request,response,JsonUtil.jsonToBean(requestData, SysRoleDTO.class));
					break;
				/** 新增角色信息*/
				case SYS_ROLE_ADD:
					resp = sysRoleService.addRole(request,response,JsonUtil.jsonToBean(requestData, SysRoleDTO.class));
					break;
				/** 修改角色信息*/
				case SYS_ROLE_EDIT:
					resp = sysRoleService.editRole(request,response,JsonUtil.jsonToBean(requestData, SysRoleDTO.class));
					break;
				/** 删除角色信息*/
				case SYS_ROLE_DELETE:
					resp = sysRoleService.deleteRole(request,response,JsonUtil.jsonToBean(requestData, SysRoleDTO.class));
					break;
				/****************角色相关接口 ********************/
				/****************权限相关接口 ********************/
				/** 角色菜单*/
				case SYS_ROLE_MENUS:
					resp = sysAuthorityService.roleMenus(request,response,JsonUtil.jsonToBean(requestData, SysAuthorityDTO.class));
					break;
				/** 角色授权*/
				case SYS_ROLE_DO_AUTH:
					resp = sysAuthorityService.doAuth(request,response,JsonUtil.jsonToBean(requestData,SysAuthorityDTO.class));
					break;
				/****************权限相关接口 ********************/
				/****************登录日志相关接口 ********************/
				case LOG_MASTER_LOGIN_LIST:
					resp = logMasterLoginService.getMasterLoginList(request,response,JsonUtil.jsonToBean(requestData, LogMasterLoginDTO.class));
					break;
				/****************登录日志相关接口 ********************/

				/****************************系统相关接口  End**************************************/
				/****************************商城相关接口 Start **************************************/

				/** 获取专场组分页列表*/
				case MALL_APP_SPECIAL_GROUP_LIST:
					resp = mallSpecialGroupService.getSpecialGroupList(request,response,JsonUtil.jsonToBean(requestData, MallAppSpecialGroupDTO.class));
					break;
				/** 获取专场组的详细信息*/
				case MALL_APP_SPECIAL_GROUP_INFO:
					resp = mallSpecialGroupService.getSpecialGroupInfo(request,response,JsonUtil.jsonToBean(requestData, MallAppSpecialGroupDTO.class));
					break;
				/** 添加专场组信息*/
				case MALL_APP_SPECIAL_GROUP_ADD:
					resp = mallSpecialGroupService.addSpecialGroup(request,response,JsonUtil.jsonToBean(requestData, MallAppSpecialGroupDTO.class));
					break;
				/** 编辑专场组信息*/
				case MALL_APP_SPECIAL_GROUP_EDIT:
					resp = mallSpecialGroupService.editSpecialGroup(request,response,JsonUtil.jsonToBean(requestData, MallAppSpecialGroupDTO.class));
					break;
				/** 删除专场组信息*/
				case MALL_APP_SPECIAL_GROUP_DELETE:
					resp = mallSpecialGroupService.deleteSpecialGroup(request,response,JsonUtil.jsonToBean(requestData, MallAppSpecialGroupDTO.class));
					break;

				/** 获取推送组分页列表*/
				case MALL_APP_RECOMMENT_GROUP_LIST:
					resp = mallRecommentGroupService.getRecommentGroupList(request,response,JsonUtil.jsonToBean(requestData, MallAppRecommentGroupDTO.class));
					break;
				/** 获取推送组的详细信息*/
				case MALL_APP_RECOMMENT_GROUP_INFO:
					resp = mallRecommentGroupService.getRecommentGroupInfo(request,response,JsonUtil.jsonToBean(requestData, MallAppRecommentGroupDTO.class));
					break;
				/** 添加推送组信息*/
				case MALL_APP_RECOMMENT_GROUP_ADD:
					resp = mallRecommentGroupService.addRecommentGroup(request,response,JsonUtil.jsonToBean(requestData, MallAppRecommentGroupDTO.class));
					break;
				/** 编辑推送组信息*/
				case MALL_APP_RECOMMENT_GROUP_EDIT:
					resp = mallRecommentGroupService.editRecommentGroup(request,response,JsonUtil.jsonToBean(requestData, MallAppRecommentGroupDTO.class));
					break;
				/** 删除推送组信息*/
				case MALL_APP_RECOMMENT_GROUP_DELETE:
					resp = mallRecommentGroupService.deleteRecommentGroup(request,response,JsonUtil.jsonToBean(requestData, MallAppRecommentGroupDTO.class));
					break;
				/** 获取Banner组分页列表*/
				case MALL_APP_BANNER_GROUP_LIST:
					resp = mallBannerGroupService.getBannerGroupList(request,response,JsonUtil.jsonToBean(requestData, MallAppBannerGroupDTO.class));
					break;
				/** 获取Banner组的详细信息*/
				case MALL_APP_BANNER_GROUP_INFO:
					resp = mallBannerGroupService.getBannerGroupInfo(request,response,JsonUtil.jsonToBean(requestData, MallAppBannerGroupDTO.class));
					break;
				/** 添加Banner组信息*/
				case MALL_APP_BANNER_GROUP_ADD:
					resp = mallBannerGroupService.addBannerGroup(request,response,JsonUtil.jsonToBean(requestData, MallAppBannerGroupDTO.class));
					break;
				/** 编辑Banner组信息*/
				case MALL_APP_BANNER_GROUP_EDIT:
					resp = mallBannerGroupService.editBannerGroup(request,response,JsonUtil.jsonToBean(requestData, MallAppBannerGroupDTO.class));
					break;
				/** 删除Banner组信息*/
				case MALL_APP_BANNER_GROUP_DELETE:
					resp = mallBannerGroupService.deleteBannerGroup(request,response,JsonUtil.jsonToBean(requestData, MallAppBannerGroupDTO.class));
					break;
				/** 获取栏目列表数据*/
				case MALL_APP_COLUMN_LIST:
					resp = mallAppCloumnService.getAppCloumnList(request,response,JsonUtil.jsonToBean(requestData, MallAppColumnDTO.class));
					break;
				/** 获取栏目的详细信息*/
				case MALL_APP_COLUMN_INFO:
					resp = mallAppCloumnService.getAppCloumnInfo(request,response,JsonUtil.jsonToBean(requestData, MallAppColumnDTO.class));
					break;
				/** 添加栏目信息*/
				case MALL_APP_COLUMN_ADD:
					resp = mallAppCloumnService.addAppCloumn(request,response,JsonUtil.jsonToBean(requestData, MallAppColumnDTO.class));
					break;
				/** 编辑栏目信息*/
				case MALL_APP_COLUMN_EDIT:
					resp = mallAppCloumnService.editAppCloumn(request,response,JsonUtil.jsonToBean(requestData, MallAppColumnDTO.class));
					break;
				/** 删除栏目信息*/
				case MALL_APP_COLUMN_DELETE:
					resp = mallAppCloumnService.deleteAppCloumn(request,response,JsonUtil.jsonToBean(requestData, MallAppColumnDTO.class));
					break;
				/** 根据栏目类型获取分页详细列表*/
				case MALL_APP_COLUMN_DETAIL_LIST:
					resp = mallAppCloumnService.detailList(request,response,JsonUtil.jsonToBean(requestData, MallAppColumnDTO.class));
					break;
				/** 获取意见反馈列表*/

				/****************物流公司相关 Start**********************/
				case MALL_SUGGEST_LIST:
					resp = mallSuggestService.mallSuggestList(request,response,JsonUtil.jsonToBean(requestData, MallSuggestDTO.class));
					break;
				/** 获取物流分页列表*/
				case LOGISTICS_COMPANY_LIST:
					resp = logisticsCompanyService.list(requestData,request,response);
					break;
				/** 获取物流公司信息*/
				case LOGISTICS_COMPANY_INFO:
					resp = logisticsCompanyService.info(requestData,request,response);
					break;
				/** 添加物流公司*/
				case LOGISTICS_COMPANY_ADD:
					resp = logisticsCompanyService.addLogisticsCompany(requestData, request, response);
					break;
				/** 编辑物流公司*/
				case LOGISTICS_COMPANY_EDIT:
					resp = logisticsCompanyService.editLogisticsCompany(requestData, request, response);
					break;
				/** 删除物流公司*/
				case LOGISTICS_COMPANY_DELETE:
					resp = logisticsCompanyService.delete(requestData, request, response);
					break;
				/****************物流公司相关 End**********************/
				/****************************商城相关接口  End**************************************/
				/****************************通用接口  Start**************************************/
				/** 文件上传*/
				case PUBLIC_FILE_UPLOAD:
					resp = publicService.fileUpload(request,response,JsonUtil.jsonToBean(requestData, BaseDTO.class));
					break;
				/** 获取图形验证码*/
				case PUBLIC_VLIDATE_CODE:
					resp = publicService.validateCode(request,response,JsonUtil.jsonToBean(requestData, BaseDTO.class));
					break;
				/****************************通用接口  End**************************************/

				/****************************定时任务接口  Start**************************************/
				/** 获取定时任务列表*/
				case TASK_JOB_LIST:
					resp = scheduleJobService.getTaskList(request,response,JsonUtil.jsonToBean(requestData,ScheduleJobDTO.class));
					break;
				/** 获取定时任务信息*/
				case TASK_JOB_INFO:
					resp = scheduleJobService.getTaskList(request,response,JsonUtil.jsonToBean(requestData,ScheduleJobDTO.class));
					break;
				/** 添加定时任务*/
				case TASK_JOB_ADD:
					resp = scheduleJobService.addTask(request,response,JsonUtil.jsonToBean(requestData,ScheduleJobDTO.class));
					break;
				/** 编辑定时任务*/
				case TASK_JOB_UPDATE:
					resp = scheduleJobService.updateTask(request,response,JsonUtil.jsonToBean(requestData,ScheduleJobDTO.class));
					break;
				/** 删除定时任务*/
				case TASK_JOB_DELETE:
					resp = scheduleJobService.deleteTask(request,response,JsonUtil.jsonToBean(requestData,ScheduleJobDTO.class));
					break;
				/** 执行定时任务*/
				case TASK_JOB_RUN:
					resp = scheduleJobService.runTask(request,response,JsonUtil.jsonToBean(requestData,ScheduleJobDTO.class));
					break;
				/** 暂停定时任务*/
				case TASK_JOB_PAUSE:
					resp = scheduleJobService.pauseTask(request,response,JsonUtil.jsonToBean(requestData,ScheduleJobDTO.class));
					break;
				/** 恢复定时任务*/
				case TASK_JOB_RESUME:
					resp = scheduleJobService.resumeTask(request,response,JsonUtil.jsonToBean(requestData,ScheduleJobDTO.class));
					break;
				/** 重持久化定时任务*/
				case TASK_JOB_RECREATE:
					resp = scheduleJobService.recreateTask(request,response,JsonUtil.jsonToBean(requestData, ScheduleJobDTO.class));
					break;
				/** 获取定时任务执行日志*/
				case TASK_JOB_LOG_LIST:
					resp = scheduleJobService.getTaskLogList(request,response,JsonUtil.jsonToBean(requestData, LogScheduleJobDTO.class));
					break;
				/****************************定时任务接口 End**************************************/
				default:
					resp.setResponseCode(ResponseCodeEnum.SERVICE_NAME_NOT_FOUND);
					/*Util.sendResponse(JsonUtil.toJson(resp), response);*/
					break;
			}
		}catch(MsgException e){
			logger.info("调用服务失败"+request.getHeader("serviceName")+"失败"+e.getExceptionMsg()+"，失败原因："+e.getExceptionMsg());
			resp.setResponseCode(e.getMsgEnum(),e.getExceptionMsg());
		}catch (Exception e){
			e.printStackTrace();
			logger.error("调用服务失败"+request.getHeader("serviceName")+"失败",e);
			logger.info("调用服务失败"+request.getHeader("serviceName")+"失败");
			resp.setResponseCode(ResponseCodeEnum.FAILURE,"系统异常");
		}

		if(serviceNameEnum.isLog()){
			BaseDTO baseDTO = JsonUtil.jsonToBean(requestData,BaseDTO.class);
			//请求服务名
			logOperation.setOpServiceName(serviceNameEnum.name());
			if(null != baseDTO){
				logOperation.setOpServiceName(serviceNameEnum.name() + "."+baseDTO.getServiceName());
				logOperation.setMaId(baseDTO.getUid());
				logOperation.setMaName(baseDTO.getUname());
				logOperation.setOpIp(baseDTO.getIp());
			}
			logOperation.setOpServiceDesc(serviceNameEnum.getDesc());
			logOperation.setOpModule("manage");
			logOperation.setOpUrl(request.getRequestURI());
			logOperation.setOpResptime(new Date());
			if(serviceNameEnum.isLogParam()){
				logOperation.setOpParams(requestData);
			}
			logOperation.setOpResponseCode(resp.getRes_code());
			if(serviceNameEnum.isLogResult()){
				logOperation.setOpResponse(JsonUtil.toJson(resp));
			}
			//推送数据到消息队列
			try{
				publicService.sendOperationLogToMq(request,response,logOperation);
			}catch(Exception e){
				logger.info("推送日志到消息队列失败");
				e.printStackTrace();
			}
		}
		logger.info("===>执行完毕.\n");
		return resp;
	}

}